home *** CD-ROM | disk | FTP | other *** search
/ Singles Flirt Up Your Life! (German) / Singles Flirt Up Your Life.iso / data1.cab / Statemachine / pool.lua < prev    next >
Text File  |  2004-01-29  |  1KB  |  44 lines

  1. -- pool state machine
  2.  
  3. beginStateMachine()
  4.  
  5.     onMsg("buildMenu", function(msg)
  6.     
  7.         if (repairMenu()) then return end
  8.     
  9.         -- build the pie menu
  10.         clearPieMenu();
  11.         local character = getStateObjectFromID(msg.sender);
  12.         local button;
  13.         local stateMachineName = character.walkSO.getStateMachine().getName();
  14.         --print("buildMenu stateMachineName: " .. stateMachineName);
  15.         button = addPieMenuButton("pm_enterPool", "enterPool");
  16.         button.addDescription(ACTIVITY, "swim");
  17.     end )
  18.     
  19.     -- swim
  20.     onMsg("enterPool", function(msg)
  21.     
  22.         local character = getStateObjectFromID(msg.sender);
  23.         local entryPoints = this.getEntryPoints(character);
  24.         for p = 1, getn(entryPoints) do
  25.             print(" entryPoint " .. p);
  26.             local actionPoint = entryPoints[p];
  27.                                                 
  28.             -- get the walk state object
  29.             local wso = character.walkSO;
  30.             if (wso.walkToActionPoint(actionPoint)) then
  31.                 wso.queueStateMachine("poolChar.sitDown", this);
  32.                 return
  33.             end
  34.         
  35.         end
  36.         print("no path found");
  37.         instantAbort(character, EMOTICON_NOPATH, "emoThink")
  38.         
  39.     end )
  40.     
  41.     
  42.             
  43. endStateMachine()
  44.